#!/usr/bin/env python
#
# This file contains functions aimed at extracting sentences that contain information
# about the entity being searched.
#

# Imports

#
# Function to extract sentences that contain the exact entity keywords.
#
# Inputs: 
#     - List of sentences
#     - The query term that is being searched for
# Output: List of sentences that contain the exact query term
#
def ExtractExactEntitySentences(sentences, query_term):
    
    # sentences to be returned
    entity_sentences = []
    
    # Loop over each sentence of input
    for sentence in sentences:
        
        # Split the query_term on a space (in case query term had two parts)
        (firstname, lastname) = query_term.split(' ')
        
        # TODO: This code checks for the entire query name, not a piece of it
        # Check if the sentence contains the query term
        #if query_term.lower() in sentence.lower():
         
        # Check if the sentence contains the last name of the query term (i.e. Jobs, for Steve Jobs)  
        if lastname.lower() in sentence.lower():
                
            # Add the sentence to the list of output sentences
            entity_sentences.append(sentence)
            
    # return the sentences that contain the entity
    return entity_sentences